<?php 
defined('_JEXEC') or die('Restricted access');
AdminUIHelper::startAdminArea ();
$canbo=$this->canbo;
$iamgeurl=($this->uploadimg=='kaka.jpg')? $canbo->cb_hinhanh : $this->uploadimg;
$iamgeurllll='../administrator/components/com_svquanlycanbo/uploads/'.$iamgeurl;
?>
<script type="text/javascript">
function kaka()
{
	alert("anh yeu em");
}
function limiter(){
	// check ten blank
	var name= document.adminForm.ten.value;
	if(name=="") document.getElementById('loiten').innerHTML="(!)  Not blank.!";
	else  document.getElementById('loiten').innerHTML="";
	// check phong ban
	var idphongban= document.adminForm.idphongban.value;
	if(idphongban==0) document.getElementById('loiphongban').innerHTML="(!) Not blank.!";
	else  document.getElementById('loiphongban').innerHTML="";
	// check chuc vu
	var idchucvu= document.adminForm.idchucvu.value;
	if(idchucvu==0) document.getElementById('loichucvu').innerHTML="(!) Not blank.!";
	else  document.getElementById('loichucvu').innerHTML="";
	// check chuc danh
	var idchucdanh= document.adminForm.idchucdanh.value;
	if(idchucdanh=="") document.getElementById('loichucdanh').innerHTML="(!) Not blank.!";
	else  document.getElementById('loichucdanh').innerHTML="";
	// check dia chi
	var diachi= document.adminForm.diachi.value;
	if(diachi=="") document.getElementById('loidiachi').innerHTML="(!) Not blank.!";
	else  document.getElementById('loidiachi').innerHTML="";
	// check namsinh
	var namsinh= document.adminForm.namsinh.value;
	if(namsinh=="") document.getElementById('loinamsinh').innerHTML="(!) Not blank.!";
	else  document.getElementById('loinamsinh').innerHTML="";
	// check dantoc
	var dantoc= document.adminForm.dantoc.value;
	if(dantoc=="") document.getElementById('loidantoc').innerHTML="(!) Not blank.!";
	else  document.getElementById('loidantoc').innerHTML="";
	// check tongiao
	var tongiao= document.adminForm.tongiao.value;
	if(tongiao=="") document.getElementById('loitongiao').innerHTML="(!) Not blank.!";
	else  document.getElementById('loitongiao').innerHTML="";
	// check cmnd
	var cmnd= document.adminForm.cmnd.value;
	if(cmnd=="") document.getElementById('loicmnd').innerHTML="(!) Not blank.!";
	else  document.getElementById('loicmnd').innerHTML="";
	// check gioitinh
	var gioitinh= document.adminForm.gioitinh.value;
	if(gioitinh=="") document.getElementById('loigioitinh').innerHTML="(!) Not blank.!";
	else  document.getElementById('loigioitinh').innerHTML="";
	// check honnhan
	var dienthoai= document.adminForm.dienthoai.value;
	if(dienthoai=="") document.getElementById('loidienthoai').innerHTML="(!) Not blank.!";
	else  document.getElementById('loidienthoai').innerHTML="";
	// check mieuta
	var mieuta= document.adminForm.mieuta.value;
	if(mieuta=="") document.getElementById('loimieuta').innerHTML="(!) Not blank.!";
	else  document.getElementById('loimieuta').innerHTML="";
			}
</script>
<form name="adminForm" enctype="multipart/form-data" method="post"  onmousemove="limiter()">
	<input type='hidden' name='task' />
	<input type='hidden' name='hinhanh' value='<?php echo $iamgeurl; ?>' />
	<input type='hidden' name='idcanbo' value='<?php echo $this->idcanbo; ?>' />
	<input type='hidden' name='idqlc' value='<?php echo $canbo->qlc_id; ?>' />
	<fieldset>
		<legend>Chi tiết cán bộ chỉnh sửa </legend>
		<table class="admintable" style="width:50%; float:left;" >
			<tr>
				<td class="key">Tên</td>
				<td>
				<input  onkeyup="limiter()" style="width:250px;" type="text" name="ten" value="<?php echo ($this->ten=='')? $canbo->cb_ten : $this->ten; ?>" />
				<b style="color:red;text-align:center;" id="loiten"  ></b>
				</td>
			</tr>
						<tr>
				<td class="key">Hình ảnh</td>
				<td> 
		     	<?php echo '<img width="120" height="120" src="'.$iamgeurllll.'" alt="svbongda" />'; ?>
		     	<br />
		     	<input type="file" name="file" id="file" /> 
				<input type="submit"  value="Submit" onclick="document.adminForm.submit();" />
		     	</td>
			</tr>
             <tr>
                 <td class="key">Phòng ban</td>
                   <td>
                       <select style="width:250px;" name="idphongban" id="idphongban" class="inputbox" size="1">
                           
                            <?php 
                            echo ' <option value="'.$canbo->qlc_idphongban.'" selected="selected">'.$canbo->phongban.'</option>';
                            foreach($this->listPhongban as $record)
                            {
	                        echo '<option value="'.$record->key.'">'.$record->text.'</option>';
                            }
                            ?>                                                                                  
                        </select>  
                        <b style="color:red;text-align:center;" id="loiphongban"  ></b>                
                    </td>
              </tr>
						<tr>
				<td class="key">Chức vụ</td>
				 <td>
                       <select style="width:250px;" name="idchucvu" id="idchucvu" class="inputbox" size="1">
                            <?php 
                            echo ' <option value="'.$canbo->qlc_idchucvu.'" selected="selected">'.$canbo->chucvu.'</option>';
                            foreach($this->listChucvu as $record)
                            {
	                        echo '<option value="'.$record->cv_id.'">'.$record->cv_ten.'</option>';
                            }
                            ?>                                                                                  
                        </select>  
                        <b style="color:red;text-align:center;" id="loichucvu"  ></b>                
                  </td>
			</tr>
						<tr>
				<td class="key">Chức danh</td>
				  <td>
                       <select style="width:250px;" name="idchucdanh" id="idchucdanh" class="inputbox" size="1">
                            <?php 
                            echo ' <option value="'.$canbo->qlc_idchucdanh.'" selected="selected">'.$canbo->chucdanh.'</option>';
                            foreach($this->listChucdanh as $record)
                            {
	                        echo '<option value="'.$record->cd_id.'">'.$record->cd_ten.'</option>';
                            }
                            ?>                                                                                  
                        </select>     
                        <b style="color:red;text-align:center;" id="loichucdanh"  ></b>             
                 </td>
			</tr>
						<tr>
				<td class="key">Địa chỉ</td>
				<td>
				<textarea name="diachi" rows="3" cols="32" ><?php echo ($this->diachi=='')? $canbo->cb_diachi : $this->diachi; ?></textarea>
				<b style="color:red;text-align:center;" id="loidiachi"  ></b>
				</td>
			</tr>
						<tr>
				<td class="key">Số điện thoại</td>
				<td>
				<input style="width:250px;" type="text" name="dienthoai" value="<?php echo ($this->dienthoai=='')? $canbo->cb_sodienthoai : $this->dienthoai; ?>" />
				<b style="color:red;text-align:center;" id="loidienthoai"  ></b>
				</td>
			</tr>

		</table>
		<!-- ---------------------------------------------------------------------------- -->
				<table class="admintable" style="width:50%; float:left;">
						<tr>
				<td class="key">Quê quán</td>
				<td>
				<input style="width:250px;" type="text" name="quequan" value="<?php echo ($this->quequan=='')? $canbo->cb_quequan : $this->quequan; ?>" />
				<b style="color:red;text-align:center;" id="loiquequan"  ></b>
				</td>
			</tr>
			<tr>
				<td class="key">Năm sinh</td>
				<td>
				<?php echo ($this->namsinh=='')? JHtml::calendar($canbo->cb_namsinh, 'namsinh', 'namsinh'):JHtml::calendar($this->namsinh, 'namsinh', 'namsinh'); ?>
				<b style="color:red;text-align:center;" id="loinamsinh"  ></b>
				</td>
			</tr>
			<tr>
				<td class="key">Dân tộc</td>
				<td>
				<input style="width:250px;" type="text" name="dantoc" value="<?php echo ($this->dantoc=='')? $canbo->cb_dantoc : $this->dantoc; ?>" />
				<b style="color:red;text-align:center;" id="loidantoc"  ></b>
				</td>
			</tr>
			<tr>
				<td class="key">Tôn giáo</td>
				<td>
				<input style="width:250px;" type="text" name="tongiao" value="<?php echo ($this->tongiao=='')? $canbo->cb_tongiao : $this->tongiao; ?>" />
				<b style="color:red;text-align:center;" id="loitongiao"  ></b>
				</td>
			</tr>
			<tr>
				<td class="key">Số CMND</td>
				<td>
				<input style="width:250px;" type="text" name="cmnd" value="<?php echo ($this->cmnd=='')? $canbo->cb_cmnd : $this->cmnd; ?>" />
				<b style="color:red;text-align:center;" id="loicmnd"  ></b>
				</td>
			</tr>
						<tr>
				<td class="key">Giới tính</td>
				<td>
					<select name="gioitinh" id="gioitinh" class="inputbox" size="1">
					    <?php echo ($this->cmnd=='')? '<option  select="selected"  value="'.$canbo->cb_gioitinh.'">'.$canbo->cb_gioitinh.'</option>'  : '<option  select="selected"  value="'.$this->gioitinh.'">'.$this->gioitinh.'</option>'; ?>
						<option value="Nam">Nam</option>
						<option value="Nữ">Nữ</option>
						<option value="Gay">Gay</option>
						<option value="Les">Les</option>
						<option value="Không xác định">Không xác định</option>
					</select>
					<b style="color:red;text-align:center;" id="loigioitinh"  ></b>
				</td>
			</tr>
						<tr>
				<td class="key">Tình trạng hôn nhân</td>
				<td>
					<select name="honnhan" id="honnhan" class="inputbox" size="1">
					   <?php echo ($this->cmnd=='')? '<option  select="selected"  value="'.$canbo->cb_honnhan.'">'.$canbo->cb_honnhan.'</option>'  : '<option  select="selected"  value="'.$this->honnhan.'">'.$this->honnhan.'</option>'; ?>
						<option value="Độc thân">Độc thân</option>
						<option value="Đã lập gia đình">Đã lập gia đình</option>
						<option value="Không xác định">Không xác định</option>
					</select>
					<b style="color:red;text-align:center;" id="loihonnhan"  ></b>
				</td>
			</tr>
			<tr>
				<td class="key">Miêu tả</td>
				<td>
				<textarea name="mieuta" rows="10" cols="50" ><?php echo ($this->mieuta=='')? $canbo->cb_mieuta : $this->mieuta;?></textarea>
				<b style="color:red;text-align:center;" id="loimieuta"  ></b>
				</td>
			</tr>
		</table>
	</fieldset>
</form>